﻿/******************************************************************************
 * Copyright (C) 2015  671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef SHARED_COMMON_H_
#define SHARED_COMMON_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

#include <cstdint>
#include <string>
#include <vector>

#ifdef __WIN32__
#define UI64LIT(N) N ## ui64
#endif


namespace Shared {

    ///////////////////////////////////////////////////////////////////////////////
    /* 接受的客户端版本列表 */
#define EXPECTED_NODE_CLIENT_BUILD        {6141}
    bool isAcceptableClientBuild(::std::uint32_t build);


    ///////////////////////////////////////////////////////////////////////////////
    /* 帐号等级 */
    enum eAccountTypes
    {
        SEC_PLAYER = 0,
        SEC_MODERATOR = 1,
        SEC_GAMEMASTER = 2,
        SEC_ADMINISTRATOR = 3,
        SEC_CONSOLE = 4
    };


    ///////////////////////////////////////////////////////////////////////////////
    /* 服务器标志 */
    enum eRealmFlags
    {
        REALM_FLAG_NONE = 0x00,
        REALM_FLAG_INVALID = 0x01,
        REALM_FLAG_OFFLINE = 0x02,
        REALM_FLAG_SPECIFYBUILD = 0x04,                         // client will show realm version in RealmList screen in form "RealmName (major.minor.revision.build)"
        REALM_FLAG_UNK1 = 0x08,
        REALM_FLAG_UNK2 = 0x10,
        REALM_FLAG_NEW_PLAYERS = 0x20,
        REALM_FLAG_RECOMMENDED = 0x40,
        REALM_FLAG_FULL = 0x80
    };


    ///////////////////////////////////////////////////////////////////////////////
    /* 地域数据 */
    enum LocaleConstant
    {
        LOCALE_enUS = 0,    /* enGB */
        LOCALE_koKR = 1,
        LOCALE_frFR = 2,
        LOCALE_deDE = 3,
        LOCALE_zhCN = 4,
        LOCALE_zhTW = 5,
        LOCALE_esES = 6,
        LOCALE_esMX = 7
    };

#define MAX_LOCALE 8
#define DEFAULT_LOCALE LOCALE_enUS

    LocaleConstant getLocaleByName(const std::string& name);

    typedef std::vector<::std::string> StringVector;
    extern char const* localeNames[MAX_LOCALE];

    struct LocaleNameStr
    {
        char const* name;
        LocaleConstant locale;
    };
    extern LocaleNameStr const fullLocaleNameList[];

}

#endif // SHARED_COMMON_H_
